home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Library
/
RoseWare - Network Support Library.iso
/
apidev
/
ndr3.exe
/
SHOWVER.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-11-23
|
15KB
|
421 lines
/*
SHOWVER is a very simple NVER replacement that demonstrates
the use of the VERIPX, VERODI, VERNETX, VERVLM and
VERLITE modules.
Author: Tim Farley
Copyright 1993, Tim Farley, All Rights Reserved
*/
#include <stdlib.h>
#include <stdio.h>
/*
VERODI definitions
*/
extern int GetLSLVersion( int * maxBoards, int * maxStacks );
typedef struct {
char Signature[ 26 ]; /* always "HardwareDriverMLID" */
unsigned char ConfigTableMajorVer;
unsigned char ConfigTableMinorVer;
unsigned char NodeAddress[ 6 ];
unsigned int ModeFlags;
unsigned int BoardNumber;
unsigned int BoardInstance;
unsigned int MaxPacketSize;
unsigned int BestDataSize;
unsigned int WorstDataSize;
char far * CardLongName;
char far * CardShortName;
char far * FrameString;
char Reserved0[ 2 ];
unsigned int FrameID;
unsigned int TransportTime;
void far * RouteHandler;
unsigned int LookAheadSize;
unsigned int LineSpeed;
unsigned int QueueDepth;
char Reserved1[ 6 ];
unsigned char MLIDMajorVer;
unsigned char MLIDMinorVer;
unsigned int Flags;
unsigned int SendRetries;
void far * Link;
unsigned int SharingFlags;
unsigned int Slot;
unsigned int IOAddress1;
unsigned int IORange1;
unsigned int IOAddress2;
unsigned int IORange2;
unsigned long MemoryAddress1;
unsigned int MemorySize1;
unsigned long MemoryAddress2;
unsigned int MemorySize2;
unsigned char IntLine1;
unsigned char IntLine2;
unsigned char DMALine1;
unsigned char DMALine2;
} MLIDConfigTable;
typedef MLIDConfigTable far * MLIDPtr;
extern int GetMLIDConfig( int boardNumber, MLIDPtr * configPtr );
typedef struct {
unsigned char ConfigTableMajorVer;
unsigned char ConfigTableMinorVer;
char far * ProtocolLongName;
char far * ProtocolShortName;
unsigned char ProtocolMajorVer;
unsigned char ProtocolMinorVer;
char ConfigTableReserved[ 16 ];
} ProtocolConfigTable;
typedef ProtocolConfigTable far * ProtocolPtr;
extern int GetProtocolConfig( int protoNumber, ProtocolPtr * configPtr );
/* return values */
#define GMC_SUCCESS (int)(0)
#define GMC_NO_MORE_ITEMS (int)(0x8003) /* not found & none beyond */
#define GMC_ITEM_NOT_PRESENT (int)(0x8004) /* not found, but might be more */
extern char * GetNetCfgPath( void );
/*
VERIPX definitions
Note that these functions return version numbers "packed"
into a single int. This allows easy version comparisons
like "GetIPXVersion() > 0x030A" (to test if IPX 3.10+
is present). Each byte of the int should be interpreted
as a DECIMAL value.
*/
extern int GetIPXVersion( void );
extern int GetSPXVersion( void );
/*
VERNETX definitions
This is just a variation on the standard NetWare API call
of the same name.
*/
extern int GetNetWareShellVersion( int * revLevel, int * shellType );
/*
VERVLM definitions
*/
extern int GetVLMVersion( int whichVLM );
#define VLM_EXE 0x0001 /* VLM Manager */
#define VLM_CONN 0x0010 /* Connection Table Manager */
#define VLM_TRAN 0x0020 /* Transport Multiplexor */
#define VLM_IPXNCP 0x0021 /* NCP over IPX */
#define VLM_NWP 0x0030 /* NetWare Protocol */
#define VLM_BIND 0x0031 /* Bindery Services */
#define VLM_NDS 0x0032 /* Directory Services */
#define VLM_PNW 0x0033 /* Personal NetWare */
#define VLM_RSA 0x0034 /* RSA Security */
#define VLM_REDIR 0x0040 /* DOS Redirector */
#define VLM_FIO 0x0041 /* File I/O */
#define VLM_PRINT 0x0042 /* Printing Services */
#define VLM_GENERAL 0x0043 /* General NetWare API's */
#define VLM_NETX 0x0050 /* NETX Compatibility */
#define VLM_AUTO 0x0060 /* Auto re-connection */
#define VLM_SECURITY 0x0061 /* Security Services */
#define VLM_NMR 0x0100 /* NetWare Management Responder */
/*
VERLITE definitions
*/
extern int GetLiteClientVersion( void );
extern int GetLiteServerVersion( void );
/*
Macros for taking apart version numbers
*/
#define HIBYTE(n) (((int)n >> 8) & 0xFF )
#define LOBYTE(n) ( (int)n & 0xFF )
/* function defined later in this module */
void CopyFarStringToLocal( char * local, size_t localSize,
char far * remote );
/*
SHOWVER MAIN PROGRAM
*/
int main( int argc, char ** argv )
{
int LSLver, maxLSLboards, maxLSLstacks;
int board, protocol, returnCode;
char buff[ 75 ];
MLIDPtr mlidConfig;
ProtocolPtr protocolConfig;
int IPXver, SPXver;
int NETXver, NETXtype, NETXrev, VLMver, VLMModuleVer;
int NWLClient, NWLServer;
int vlmID, vlmCount = 0;
printf( "SHOWVER -- Displays versions of loaded NetWare components\n"
"Copyright 1993, Tim Farley, All Rights Reserved\n\n" );
/*
Use VERODI to get ODI driver information
*/
LSLver = GetLSLVersion( &maxLSLboards, &maxLSLstacks );
if ( 0 == LSLver )
printf( "ODI is not loaded\n" );
else {
printf( "LSL: v%d.%02d", HIBYTE( LSLver ), LOBYTE( LSLver ) );
/*
Early versions of LSL don't support the max numbers,
so only display them if they are reasonable.
*/
if ( 0 == maxLSLboards )
maxLSLboards = 8; /* so our for loop later will work */
else
printf( ", Max boards: %d", maxLSLboards );
if ( 0 == maxLSLstacks )
maxLSLstacks = 8; /* so our for loop later will work */
else
printf( ", Max stacks: %d", maxLSLstacks );
printf( "\n" );
/*
Display the location of NET.CFG
*/
if ( NULL == GetNetCfgPath() )
printf( "NET.CFG cannot be located\n" );
else
printf( "NET.CFG: %s\n", GetNetCfgPath() );
/*
Try each possible board # looking for loaded MLID's.
*/
for ( board = 0; board <= maxLSLboards; board++ ) {
returnCode = GetMLIDConfig( board, &mlidConfig );
if ( GMC_NO_MORE_ITEMS == returnCode )
break; /* if no more board, break out of the loop */
else if ( GMC_SUCCESS == returnCode ) {
/*
Note that the same MLID will often show up multiple
times here---once for each "frame type" you are using.
This is the "logical" board concept that ODI uses to
differentiate between frame types on a single card.
If you need to filter out multiple logical cards that
represent the same MLID, you will have to use ad-hoc
means, such as comparing the MLID name plus the NIC
address in the table, or perhaps comparing the segment
values of the returned table pointers.
*/
printf( "MLID: " );
/*
Display MLID name and version number
*/
CopyFarStringToLocal( buff, sizeof( buff ),
mlidConfig->CardShortName );
printf( "%-8s v%d.%02d", buff,
mlidConfig->MLIDMajorVer, mlidConfig->MLIDMinorVer );
/*
Display the frame type for this logical board
*/
CopyFarStringToLocal( buff, sizeof( buff ),
mlidConfig->FrameString );
printf( " (%s)\n", buff );
} /* if we found the MLID */
} /* for each possible MLID */
/*
Try each possible protocol # looking for loaded protocols.
*/
for ( protocol = 0; protocol <= maxLSLboards; protocol++ ) {
returnCode = GetProtocolConfig( protocol, &protocolConfig );
if ( GMC_NO_MORE_ITEMS == returnCode )
break; /* if no more protocols, break out of the loop */
else if ( GMC_SUCCESS == returnCode ) {
printf( "Protocol: " );
CopyFarStringToLocal( buff, sizeof( buff ),
protocolConfig->ProtocolShortName );
printf( "%-8s v%d.%02d\n", buff,
protocolConfig->ProtocolMajorVer,
protocolConfig->ProtocolMinorVer );
} /* if we found the protocol */
} /* for each possible protocol */
} /* if LSL was present */
/*
Use VERIPX to get IPX and SPX versions.
*/
printf( "\n" );
IPXver = GetIPXVersion();
if ( 0 == IPXver )
printf( "IPX/SPX is not loaded\n" );
else {
printf( "IPX: "
"v%d.%02d\n", HIBYTE( IPXver ), LOBYTE( IPXver ) );
/* SPX can only be present if IPX is */
SPXver = GetSPXVersion();
if ( 0 == SPXver )
printf( "SPX is not loaded\n" );
else
printf( "SPX: "
"v%d.%02d\n", HIBYTE( SPXver ), LOBYTE( SPXver ) );
}
/*
Use VERVLM to see if VLM is present.
*/
printf( "\n" );
VLMver = GetVLMVersion( VLM_EXE );
if ( 0 == VLMver )
printf( "VLM is not loaded\n" );
else {
printf( "VLM: "
"v%d.%02d\n", HIBYTE( VLMver ), LOBYTE( VLMver ) );
/*
Show the equivalent NETX version using the old calls.
*/
NETXver = GetNetWareShellVersion( &NETXrev, &NETXtype );
if ( 0 == NETXver )
printf( " (NETX compatibility not loaded)\n" );
else
printf( " (NETX compatibility is v%d.%02d)\n",
HIBYTE( NETXver ), LOBYTE( NETXver ) );
/*
Show what other VLM modules are present. We do this just by
iterating through many possible VLM ID #'s and checking to
see if each is loaded by calling its version number routine.
*/
printf( " VLM Modules loaded:" );
for ( vlmID = 2; vlmID <= VLM_NMR; vlmID++ ) {
VLMModuleVer = GetVLMVersion( vlmID );
if ( VLMModuleVer ) {
if ( 0 == ( vlmCount % 4 ) )
printf( "\n" );
vlmCount++;
printf( " " );
switch ( vlmID ) {
/* show hex value for VLM's we don't recognize */
default : printf( "VLM#%04X", vlmID ); break;
/* otherwise show the name if known */
case VLM_AUTO : printf( "AUTO " ); break;
case VLM_BIND : printf( "BIND " ); break;
case VLM_CONN : printf( "CONN " ); break;
case VLM_FIO : printf( "FIO " ); break;
case VLM_GENERAL : printf( "GENERAL " ); break;
case VLM_IPXNCP : printf( "IPXNCP " ); break;
case VLM_NDS : printf( "NDS " ); break;
case VLM_NETX : printf( "NETX " ); break;
case VLM_NMR : printf( "NMR " ); break;
case VLM_NWP : printf( "NWP " ); break;
case VLM_PNW : printf( "PNW " ); break;
case VLM_PRINT : printf( "PRINT " ); break;
case VLM_REDIR : printf( "REDIR " ); break;
case VLM_RSA : printf( "RSA " ); break;
case VLM_SECURITY : printf( "SECURITY" ); break;
case VLM_TRAN : printf( "TRAN " ); break;
} /* switch vlmID */
/*
If this VLM has a different version than VLM.EXE,
display it. Currently this usually only happens with
NETX.VLM, but in the future, who knows?
*/
if ( VLMModuleVer != VLMver )
printf( " v%d.%02d",
HIBYTE( VLMModuleVer ), LOBYTE( VLMModuleVer ) );
else
printf( " " );
} /* if VLM found */
} /* for each possible VLM */
printf( "\n" );
} /* VLM is present */
/*
Use VERNETX to get the NETX version.
(But only if VLM shell was not present!)
*/
if ( 0 == VLMver ) {
NETXver = GetNetWareShellVersion( &NETXrev, &NETXtype );
if ( 0 == NETXver )
printf( "NETX is not loaded\n" );
else {
switch ( NETXtype ) {
default :
case 0 : printf( "NETX: " ); break;
case 1 : printf( "EMSNETX:" ); break;
case 2 : printf( "XMSNETX:" ); break;
}
printf( " v%d.%02d", HIBYTE( NETXver ), LOBYTE( NETXver ) );
printf ( " Rev. %c\n", (char)('A' + (char)NETXrev ) );
} /* NETX is present */
} /* VLM is not present */
/*
Use VERLITE to get NetWare Lite version numbers.
NOTE: The low part of Lite version numbers is just one digit
unlike the other Novell version numbers.
*/
printf( "\n" );
NWLClient = GetLiteClientVersion();
NWLServer = GetLiteServerVersion();
if ( ( 0 == NWLClient ) && ( 0 == NWLServer ) )
/* Neither client nor server is loaded */
printf( "NetWare Lite is not loaded\n" );
else {
/*
Show if CLIENT.EXE is loaded
*/
if ( NWLClient )
printf( "NetWare Lite Client: v%d.%1d\n",
HIBYTE( NWLClient ), LOBYTE( NWLClient ) );
else
printf( "NetWare Lite Client not loaded\n" );
/*
Show if SERVER.EXE is loaded
*/
if ( NWLServer )
printf( "NetWare Lite Server: v%d.%1d\n",
HIBYTE( NWLServer ), LOBYTE( NWLServer ) );
else
printf( "NetWare Lite Server not loaded\n" );
}
return ( 0 );
} /* main() */
/*
CopyFarStringToLocal
Copies a pascal-style string (length byte preceding)
that is pointed to by a far pointer, to a local buffer
so we can work with it more normally.
*/
void CopyFarStringToLocal( char * local, size_t localSize,
char far * remote )
{
int i;
int maxSize = (int)remote[ 0 ];
if ( maxSize > (int)localSize - 1 )
maxSize = (int)localSize - 1;
for ( i = 0; i < maxSize; i++ )
if ( 0 == ( local[ i ] = remote[ i + 1 ] ) )
break;
local[ i ] = 0;
} /* CopyFarStringToLocal() */
/* eof: SHOWVER.C */